<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page import="java.util.Vector,
                                    com.epro.standard.frontend.util.FileInfoUtil,
                                    com.softplus.carrefour.hd.bltier.pc.*,
                                    com.softplus.carrefour.hd.CFHDSystem,
                                    com.softplus.carrefour.CFException,
                                    com.softplus.carrefour.hd.bltier.entity.UserAccount,
                                    com.softplus.carrefour.hd.bltier.entity.CfhdCaseHead,
                                    com.epro.standard.frontend.datasetup.MessageManager,
                                    com.softplus.carrefour.hd.bltier.admin.UserLevelManage" 
%>
<%@ include file="../include/eproFileInfo.jsp" %>
<%@ taglib uri="/WEB-INF/HeadTag.tld" prefix="head"%>
<%@ taglib uri="/WEB-INF/ErrorTag.tld" prefix="error"%>
<%
        // View All Case L2C  View 
        ICaseHeadViewer     headViwer        = (CCaseHeadManage)CFHDSystem.getControlClass("CASE_HEAD");

        UserAccount                userVO              = (UserAccount) session.getAttribute("userVO"); //"cheewin_v";       
        String                            caseType          =  request.getParameter("caseType")!=null?request.getParameter("caseType"):"all";
        
        System.out.println(userVO);
        
        FileInfoUtil                    fileInfoUtil        = (FileInfoUtil)session.getAttribute("fileInfoUtil");
        String                            menuIDCode  = "CFHDPCMT03";
        String                            PageName	   = " View All Cases : User Level 2 Country";
        String                            menuDesc	   = " View All Cases : User Level 2 Country";

        String          opnPageURL   = "CFHDPCMT05.jsp"; //open Case Page
        String          viewPageURL  = "CFHDPCMT06.jsp"; //view Page
        String          modPageURL  = "/CFHD/servlet/com.softplus.carrefour.hd.frontend.servlet.process.CFHDPC07_0"; //"CFHDPCMT07.jsp"; //modify Page
        String          thisURL              = java.net.URLEncoder.encode((request.getRequestURI()+(request.getQueryString()!=null?"?"+request.getQueryString():"")));
        String          menuPgURL    = "/CFRL/CFRLWEBMN01.jsp";
         fileInfoUtil.setMenuIDCode(menuIDCode);
        fileInfoUtil.setMenuName(menuDesc);
        fileInfoUtil.setMasterWording(" View All Cases : User Level 2 Country");
        fileInfoUtil.setMenuDesc(PageName);
//        fileInfoUtil.setBackToMenu("/CFRL/CFRLWEBMN01.jsp");
        fileInfoUtil.setBackToMenu(thisURL);
        
        session.setAttribute("fileInfoUtil",fileInfoUtil);
        
//        String          scrollHieght     =  "100px";
//        String          scrollFull          =  "330px";
//        String          scrollNodata    =  "18px";
        String          scrollHieght     =  "58px";
        String          scrollFull          =  "305px";
        String          scrollNodata    =  "18px";
             
        System.out.println(" * * * * * * * *  "+request.getRequestURL());
%>
<html>
  <head>
    <title>View All Cases : User Level 2 Country View.</title>
          <script src="../script/spToolbar.js" type="text/javascript"></script>
          <script src="../script/Alert.js" type="text/javascript"></script>
          <script src="../script/spTitleRefresh.js" type="text/javascript"></script>
          <link rel="stylesheet" href="../theme/viewCaseTheme.css" />
          <link rel="stylesheet" href="../theme/defaultTheme.css" />
          <%@ include file="../include/spPageRefresh.jsp" %>
          <%@ include file="../include/spienocache.jsp" %>
          <%@ include file="../include/spAuthorization.jsp" %>
</head>
  <body style="width:750px;">
    <%@ taglib uri="/WEB-INF/displaytag-12.tld" prefix="display"%>
     <%=   fileInfoUtil.MasterHeadTable()  %>
<table width="99%"  border="0" cellspacing="0" cellpadding="0" style="margin-left:0px;">
  <tr>
    <td align="center">
    <form action="<%= request.getRequestURI()+"?"+request.getQueryString() %>" id="form1" method="get">
     <%
          java.util.Enumeration    e =  request.getParameterNames();
          while(e.hasMoreElements()){
          
               String    paramName =    (String) e.nextElement();
               String    paramValue  = request.getParameter(paramName);
//               System.out.print("paramName : >"+paramName+"< ");
//               System.out.println(" = >"+paramValue+"< ");
               if(!paramName.equalsIgnoreCase("casetype")){
                    out.println("<input type=\"HIDDEN\" name=\""+paramName+"\" value=\""+paramValue+"\" />");
               }
          }
    %>   
	<fieldset class="titleFont" style=" width:65%; margin:5px 15px 2px 25px;"><legend>Case Category</legend>
		<table border="0" align="center" cellpadding="2" cellspacing="1">
		<tr><td>&nbsp;</td>
          <td nowrap ><input name="caseType" type="radio" id="allCase" value="all" onclick="form1.submit();" <%= (caseType.equals("all")?" checked ":"") %>>
		  <label for="allCase">All</label></td>
		<td nowrap><input name="caseType" id="newRecv" type="radio" value="newrecv" onclick="form1.submit();" <%= (caseType.equals("newrecv")?" checked ":"") %>>
		  <label for="newRecv">New Recieved</label></td>
		<td nowrap><input name="caseType" id="takenCase" type="radio" value="taken" onclick="form1.submit();" <%= (caseType.equals("taken")?" checked ":"") %>>
		  <label for="takenCase">Taken Case</label></td>
		 <td nowrap><input name="caseType" id="myCase" type="radio" value="my" onclick="form1.submit();" <%= (caseType.equals("my")?" checked ":"") %>>
		  <label for="myCase">My Case</label></td>
		<td nowrap><input name="caseType" id="returnedCase" type="radio" value="returned" onclick="form1.submit();" <%= (caseType.equals("returned")?" checked ":"") %>>
		  <label for="returnedCase">Returned Case</label></td>
		<td>&nbsp;</td></tr>
		</table>
	</fieldset>
  </form>
        </td>
  </tr>
  <tr>
    <td class="borderFontColor">
    <a href="<%= menuPgURL %>"><img alt="Back to Menu" src="../images/icon/toolbar/nBackToMenu.gif" width="21" height="21" onmouseout="imgOut(this)" onmouseover="imgOver(this)"></a>
    <a href="CFHDPCMT08.jsp?linkfrom=<%= thisURL %>"><img alt="Search" src="../images/icon/toolbar/nSearch.gif" width="21" height="21" onmouseout="imgOut(this)" onmouseover="imgOver(this)"></a>
    <%= fileInfoUtil.MasterWording() %>
    </td>
  </tr>
  <tr>
    <td align="center">
<%
        try{
        
              if(caseType.equals("newrecv")||caseType.equals("all")) {
                    Vector   dataVec = headViwer.getReceiveCaseHeadByUserID(userVO.getUserId());
                    String    divHeight = scrollHieght;
                    
                     if(caseType.equals("newrecv")) divHeight = scrollFull;               
                     if (dataVec.size()==0)                   divHeight = scrollNodata;
                            session.setAttribute( "newrecv", null );
                            session.setAttribute( "newrecv", dataVec );
%>
                <span class="viewCaseHeader"> New Recieved</span>
                    <div style="height:<%= divHeight %>" class="tableContainer" id="tableContainer1">
                    <display:table name="sessionScope.newrecv" id="newrecv" defaultsort="4" styleClass="scrollTable" cellspacing="0" cellpadding="0" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.viewCaseTableWrapper">
                      <display:column headerStyleClass=" fixedHeader" title="Case No." property="newrecvcaselink" sortable="true" nowrap="true" align="left" maxLength="20" style="width:145pt;" />
                      <display:column headerStyleClass=" fixedHeader" title=" Subject " property="subject" align="left" maxLength="43" />
                       <display:column headerStyleClass=" fixedHeader" title="Owner" align="left" maxLength="10" style="padding-left:5px;width:70pt;" >&nbsp;</display:column>
                       <display:column headerStyleClass=" fixedHeader" title="Severity"  property="severity" align="left" sortable="true" style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.serverityDecorator" />
                       <display:column headerStyleClass=" fixedHeader" title="Status" property="caseStatus" align="left"  style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.caseStatusDecorator" />
                    </display:table>
                    </div>
<%       
        } 
             if(caseType.equals("taken")||caseType.equals("all")) {
                    Vector   dataVec = headViwer.getTakenCaseHeadByUserID(userVO.getUserId());
                    String    divHeight = scrollHieght;
                    
                     if(caseType.equals("taken")) divHeight = scrollFull;
                     if (dataVec.size()==0)              divHeight = scrollNodata;
                            session.setAttribute( "taken", null );
                            session.setAttribute( "taken", dataVec );
%>
                    <span class="viewCaseHeader"> Taken Case </span>
                    <div style="height:<%= divHeight %>"  class="tableContainer" id="tableContainer2">
                    <display:table name="sessionScope.taken" id="taken" defaultsort="4"  styleClass="scrollTable" cellspacing="0" cellpadding="0" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.viewCaseTableWrapper">
                      <display:column headerStyleClass=" fixedHeader" title="Case No." property="takencaselink" sortable="true" nowrap="true" maxLength="20" align="left" style="width:145pt;" />
                      <display:column headerStyleClass=" fixedHeader" title="Subject" property="subject" align="left" maxLength="43" />
                       <display:column headerStyleClass=" fixedHeader" title="Owner" property="caseowner" align="left" maxLength="10" style="padding-left:5px;width:70pt;" />
                       <display:column headerStyleClass=" fixedHeader" title="Severity" align="left" sortable="true" style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.serverityDecorator" property="severity" />
                       <display:column headerStyleClass=" fixedHeader" title="Status" property="caseStatus" align="left"  style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.caseStatusDecorator" />
                    </display:table>
                    </div>
<%
        }
        
         if(caseType.equals("my")||caseType.equals("all")) {
               Vector   dataVec = headViwer.getCaseHeadByUserID(userVO.getUserId());
               String    divHeight = scrollHieght;
               
                if(caseType.equals("my"))  divHeight  = scrollFull;              
                if (dataVec.size()==0)          divHeight  = scrollNodata;
                       session.setAttribute( "my", null );
                       session.setAttribute( "my", dataVec ); 
%>
            <span class="viewCaseHeader"> My Case </span>
            <div style="height:<%= divHeight %>"  class="tableContainer" id="tableContainer3">
            <display:table name="sessionScope.my" id="my" defaultsort="4"  styleClass="scrollTable" cellspacing="0" cellpadding="0" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.viewCaseTableWrapper">
              <display:column headerStyleClass=" fixedHeader" title="Case No." sortable="true" nowrap="true" align="left" maxLength="20" property="mycaselink" style="width:145pt;" />
              <display:column headerStyleClass=" fixedHeader" title="Subject" property="subject" align="left" maxLength="43" />
               <display:column headerStyleClass=" fixedHeader" title="Owner" property="caseowner" align="left" maxLength="10" style="padding-left:5px;width:70pt;" />
               <display:column headerStyleClass=" fixedHeader" title="Severity" property="severity" align="left" sortable="true" style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.serverityDecorator" />
               <display:column headerStyleClass=" fixedHeader" title="Status" property="caseStatus" align="left"  style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.caseStatusDecorator" />
            </display:table>
            </div>
<%  
        }
         
         if(caseType.equals("returned")||caseType.equals("all")) {
               Vector   dataVec = headViwer.getReTurnCaseHeadByUserID(userVO.getUserId());
               String    divHeight = scrollHieght; 
               
                if(caseType.equals("returned"))  divHeight =scrollFull;               
                if (dataVec.size()==0)                    divHeight = scrollNodata;
               session.setAttribute( "returned", null );
               session.setAttribute( "returned", dataVec );
%>
            <span class="viewCaseHeader"> Returned Case </span>
            <div style="height:<%= divHeight %>" class="tableContainer" id="tableContainer4">
            <display:table name="sessionScope.returned" id="returned" defaultsort="4"  styleClass="scrollTable" cellspacing="0"  decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.viewCaseTableWrapper">
              <display:column headerStyleClass=" fixedHeader" title="Case No." sortable="true" nowrap="true" align="left" property="returnedcaselink" style="width:145pt;" />
              <display:column headerStyleClass=" fixedHeader" title="Subject" property="subject" align="left"  maxLength="43" />
               <display:column headerStyleClass=" fixedHeader" title="Owner" align="left" maxLength="10" style="padding-left:5px;width:70pt;" >&nbsp;</display:column>
               <display:column headerStyleClass=" fixedHeader" title="Severity" align="left" sortable="true" style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.serverityDecorator" property="severity" />
               <display:column headerStyleClass=" fixedHeader" title="Status" property="caseStatus" align="left"  style="padding-left:5px;width:50pt;" decorator="com.softplus.carrefour.hd.frontend.displaytag.process.viewallcases.caseStatusDecorator" />
            </display:table>
            </div>
    <%
                }
        }catch(CFException cfe){
                System.out. println( cfe.getMessage());
                System.out. println( cfe.getDescription());
                session.setAttribute("hasError",cfe.getMessage());
//                cfe.printStackTrace();
        }
    %>
    </td>
  </tr>
</table>
<script type="text/javascript" src="../script/criticalHilight.js"></script>
<script type="text/javascript" src="../script/newestHilight.js"></script>
 </body>
</html>
<%@ include file="../include/eproErrorAlert.jsp"%>
